package com.dkm.dkmproject.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.dkm.dkmproject.dao.ServiceTbMapper;
import com.dkm.dkmproject.domain.ServiceTb;
import com.dkm.dkmproject.service.IServiceTbService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务表 服务实现类
 * </p>
 *
 * @author 周佳佳
 * @since 2020-04-26
 */
@Service
public class ServiceTbServiceImpl extends ServiceImpl<ServiceTbMapper, ServiceTb> implements IServiceTbService {

    @Autowired
    ServiceTbMapper serviceTbMapper;


    @Override
    public List<ServiceTb>  findAll(Integer syId) {
        return serviceTbMapper.findAll(syId);
    }

    @Override
    public ServiceTb selectByPrimaryKey(Integer scbId) {
        return serviceTbMapper.selectByPrimaryKey(scbId);
    }

    @Override
    public List<ServiceTb> selectAllTwo(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return serviceTbMapper.selectAllTwo();
    }

    @Override
    public int selectCountOne() {
        return serviceTbMapper.selectCountOne();
    }

    @Override
    public void updateByPrimaryKey(ServiceTb serviceTb) {
        serviceTbMapper.updateByPrimaryKey(serviceTb);
    }

    @Override
    public void insertSelective(ServiceTb serviceTb) {
        serviceTbMapper.insertSelective(serviceTb);
    }

    @Override
    public int updateByPrimaryKeySelective(ServiceTb serviceTb) {
        return serviceTbMapper.updateByPrimaryKeySelective(serviceTb);
    }

    @Override
    public int delete(Integer syId) {
        EntityWrapper entityWrapper=new EntityWrapper();
        entityWrapper.eq("sy_id",syId);
        return serviceTbMapper.delete(entityWrapper);
    }

    @Override
    public int deleteTwo(Integer scbId) {
        EntityWrapper entityWrapper=new EntityWrapper();
        entityWrapper.eq("scb_id",scbId);
        return serviceTbMapper.delete(entityWrapper);
    }


    @Override
    public int addService(ServiceTb serviceTb) {
        return serviceTbMapper.insert(serviceTb);
    }
}
